package com.santu.edu.supporter.biz.order.other.pojo.dto;

import com.santu.edu.supporter.biz.order.common.pojo.enums.OrderStatusEnum;
import com.santu.edu.supporter.biz.order.other.pojo.enums.OtherTypeEnum;
import com.santu.edu.supporter.biz.order.other.pojo.params.OtherOrderAddParam;
import com.santu.edu.supporter.biz.order.other.pojo.po.OtherOrderPO;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author luoyaoqi
 * @createTime 2024/2/22
 * @description
 */
@Data
@Accessors(chain = true)
public class OtherOrderDTO {

    /**
     * 学校id
     */
    private String schoolId;

    /**
     * 订单号
     */
    private String orderId;

    /**
     * 用户id(发起人)
     */
    private String userId;

    /**
     * 事情标题
     */
    private String title;

    /**
     * 事情描述
     */
    private String description;

    /**
     * 费用
     */
    private Long money;

    /**
     * 订单状态[0:待认领1:进行中2:已完成]
     */
    private OrderStatusEnum orderType;

    /**
     * 完成的状态[0:帮助人已完成1:顾客已确认]
     */
    private OtherTypeEnum taskType;


    public static OtherOrderDTO createItem(OtherOrderAddParam addParam, String orderId) {
        return new OtherOrderDTO()
                .setSchoolId(addParam.getSchoolId())
                .setOrderId(orderId)
                .setUserId(addParam.getUserId())
                .setTitle(addParam.getTitle())
                .setDescription(addParam.getDescription())
                .setMoney(addParam.getMoney())
                .setOrderType(OrderStatusEnum.IN_PROGRESS)
                .setTaskType(OtherTypeEnum.HELPER_NOT_COMPLETED);
    }



    public static OtherOrderDTO createItem(OtherOrderPO item) {
        return new OtherOrderDTO()
                .setSchoolId(item.getSchoolId())
                .setOrderId(item.getOrderId())
                .setUserId(item.getUserId())
                .setTitle(item.getTitle())
                .setDescription(item.getDescription())
                .setMoney(item.getMoney())
                .setOrderType(OrderStatusEnum.convert(item.getOrderType()))
                .setTaskType(OtherTypeEnum.convert(item.getTaskType()));
    }
}
